package com.ag.zrt.action;

import javax.annotation.Resource;

import org.springframework.beans.factory.config.BeanDefinition;
import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Controller;

import com.ag.common.BaseAction;
import com.ag.zrt.service.EventLevelService;
@Controller("deleteEventLevelAction")
@Scope(BeanDefinition.SCOPE_PROTOTYPE)
public class DeleteEventLevelAction extends BaseAction {

	/**
	 * 
	 */
	private static final long serialVersionUID = -3274492587434422755L;
	@Resource(name="EventLevelService")
	private EventLevelService eventLevelService;
	private String elId;
	private String msg;
	private String errorDetail;

	public String getMsg() {
		return msg;
	}

	public String getErrorDetail() {
		return errorDetail;
	}

	public void setElId(String elId) {
		this.elId = elId;
	}

	public void setEventLevelService(EventLevelService eventLevelService) {
		this.eventLevelService = eventLevelService;
	}

	@Override
	public String execute() {
		// TODO Auto-generated method stub
		try{
		eventLevelService.delete(eventLevelService.findById(elId));
		msg = "删除成功";
		errorDetail = "";
		return "delete_el_succ";
		}catch(Exception e){
			msg = "删除失败";
			errorDetail = e.toString();
			return "delete_el_failed";
		}
	}

}
